FROM golang:latest AS builder
ENV GOOS=linux
ENV GOPROXY=https://goproxy.cn,direct
RUN mkdir /{{.ProjectName}}
WORKDIR /{{.ProjectName}}
COPY . /{{.ProjectName}}
WORKDIR /{{.ProjectName}}/cmd
RUN go build -o main .

FROM ubuntu:latest
RUN mkdir /{{.ProjectName}}
WORKDIR /{{.ProjectName}}
COPY --from=builder /{{.ProjectName}} .

EXPOSE 8090
WORKDIR /{{.ProjectName}}/cmd
ENTRYPOINT [ "./main" ]
